console.show();
var ip = "47.120.74.135";
var port = "3000";
var repo = "autojs";
var baseUpdateUrl = "http://" + ip + ":" + port + "/" + repo;

const configs = [
  {
    file: "/src/src.zip",
    savePath: "/sdcard/src.zip",
    unZipPath: "/sdcard/脚本/src",
  },
  {
    file: "/src/ad.zip",
    savePath: "/sdcard/ad.zip",
    unZipPath: "/sdcard/脚本/ad",
  },
];
configs.forEach((config) => {
  var updateUrl = baseUpdateUrl + config.file;
  var response = http.get(updateUrl);
  files.writeBytes(config.savePath, response.body.bytes());
  files.removeDir(config.unZipPath);
  files.create(config.unZipPath + "/");
  zips.X(config.savePath, config.unZipPath);
});
console.log("下载完成");
sleep(1.5 * 1000);
console.hide();
